import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class CustomStyle {
  const CustomStyle(this.ctx);

  final BuildContext ctx;

  static Color lineColor = Color(0xFF444444);
  static Color darkBlackColor = Color(0xFF101519);
  static Color blackColor = Color(0xFF1E2531);
  static Color lightBlackColor = Color(0xFF4B4D5E);
  static Color veryLightBlackColor = Color(0xFF6D7175);

  TextStyle get appTextThemeStyle => TextStyle(
      fontSize: ScreenUtil().setSp(
        32,
      ),
      color: Theme.of(ctx).brightness == Brightness.light
          ? Colors.black
          : Colors.white,
      fontWeight: FontWeight.w500);
  TextStyle get smallStyle => Theme.of(ctx).textTheme.bodyText2!.copyWith(
          fontSize: ScreenUtil().setSp(
        22,
      ));
  TextStyle get contentStyle => Theme.of(ctx).textTheme.bodyText1!.copyWith(
        fontSize: ScreenUtil().setSp(
          24,
        ),
      );
  TextStyle get h1Style => Theme.of(ctx).textTheme.bodyText1!.copyWith(
      fontSize: ScreenUtil().setSp(
        28,
      ),
      fontWeight: FontWeight.w400);
  TextStyle get h2Style => Theme.of(ctx).textTheme.bodyText1!.copyWith(
      fontSize: ScreenUtil().setSp(
        26,
      ),
      fontWeight: FontWeight.w400);

  TextStyle customTextStyle(
          {num? fontSize, String? fontFamily, Color? color}) =>
      TextStyle(
        fontSize: ScreenUtil().setSp(fontSize ?? 24),
        color: Theme.of(ctx).brightness == Brightness.dark
            ? Colors.white
            : color ?? CustomStyle.lightBlackColor,
        fontFamily: fontFamily ?? 'PingFang_Medium',
      );

  static PreferredSize preferredSize = PreferredSize(
    preferredSize: const Size(50, -12),
    child: Container(
      alignment: Alignment.center,
      constraints: const BoxConstraints.expand(height: 0),
    ),
  );

  static int width = MediaQueryData.fromWindow(window).size.width.toInt() * 2;
  static int height = MediaQueryData.fromWindow(window).size.height.toInt() * 2;
}
